package de.fhaugsburg.games.boardgames;

/**
 * A square is part of board, each square has a specific piece or is empty.
 * default the square is empty.
 * 
 * @author r4smus
 * 
 */
public class Square<P extends IPiece, D> {

	private P piece;
	private D details;

	/**
	 * put a piece on the square.
	 * 
	 * @param piece
	 */
	public void putPiece(P piece) {
		this.piece = piece;
	}

	/**
	 * 
	 * @return the piece on the square
	 */
	public P getPiece() {
		return this.piece;
	}

	/**
	 * removes the piece on the square
	 * 
	 * @return the piece which was removed.
	 */
	public P removePiece() {
		P tempPiece = this.piece;
		this.piece = null;
		return tempPiece;
	}

	public void setDetails(D details) {
		this.details = details;
	}

	public D getDetails() {
		return details;
	}

}
